<extend name="Public/base" />

<block name="body">
	<!-- 标题栏 -->
	<div class="main-title">
            <h2>物流人员任务管理</h2>
	</div>
	<div class="cf">
            <div class="fl">
        </div>

        <!-- 高级搜索 -->
        <div class="search-form fr cf">
            <div class="sleft">
                <input type="text" name="orderid" class="search-input" value="{:I('orderid')}" placeholder="请输入订单编号">
            </div>
            <div class="sleft">
                <input type="text" name="jobnumber" class="search-input" value="{:I('jobnumber')}" placeholder="请输入用户工号">
            </div>
            <div class="sleft">
                <select name="taskstatus" id="taskstatus"  style="height: 26px;width:150px">
                    <option value="">请选择任务状态</option>
                    <option value="1" {$taskstatus=="1"?'selected':''}>正在进行</option>
                    <option value="2" {$taskstatus=="2"?'selected':''}>已转交</option>
                    <option value="0" {$taskstatus=="0"?'selected':''}>已完成</option>
                    <option value="3" {$taskstatus=="3"?'selected':''}>异常完成</option>
                    <option value="-1" {$taskstatus=="-1"?'selected':''}>手动清除</option>
                </select>
            </div>
            <div class="sleft">
                <a class="sch-btn" href="javascript:;" id="search" url="{:U('taskManager')}"><i class="btn-search"></i></a>
            </div>
        </div>
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
	<table class="">
            <thead>
                <tr>
                    <th class="">工号</th>
                    <th class="">姓名</th>
                    <th class="">订单编号</th>
                    <th class="">任务状态</th>
                    <th class="">抢单时间</th>
                    <th class="">扫码时间</th>
                    <th class="">操作</th>
                </tr>
            </thead>
            <tbody>
                <notempty name="_list">
                    <volist name="_list" id="vo">
                        <tr>
                            <td style='width: 8%'>{$vo.uid|get_jobnumber}</td>
                            <td style='width: 8%'>{$vo.uid|get_wlusername}</td>
                            <td style='width: 15%'>{$vo.orderid}</td>
                            <td style='width: 10%'>{$vo.status|mission_status}</td>
                            <td style='width: 10%'><php>echo date('Y-m-d H:i:s', strtotime($vo['rushTime']->iso));</php></td>
                            <td style='width: 10%'>{$vo.scantime|time_format13}</td>
                            <td style='width: 20%'>
                                <eq name="vo.status" value="1">
                                <a href="{:U('LogisticsUser/settask?method=end&id='.$vo['objectId'].'&orderid='.$vo['orderid'])}" class="btn btn-primary" onclick="if(confirm('确定操作?')==false)return false;">手动完成任务</a>
                                <a href="{:U('LogisticsUser/settask?method=del&id='.$vo['objectId'].'&orderid='.$vo['orderid'])}" class="btn btn-danger" onclick="if(confirm('确定操作?')==false)return false;">手动清除任务</a>
                                <a href="{:U('LogisticsUser/sendtask?id='.$vo['objectId'].'&orderid='.$vo['orderid'].'&uid='.$vo['uid'])}" class="btn btn-danger">分配任务</a>
                                </eq>
                                <eq name="vo.status" value="2">
                                <a href="{:U('LogisticsUser/settask?method=end&id='.$vo['objectId'].'&orderid='.$vo['orderid'])}" class="btn btn-primary" onclick="if(confirm('确定操作?')==false)return false;">手动完成任务</a>
                                <a href="{:U('LogisticsUser/settask?method=del&id='.$vo['objectId'].'&orderid='.$vo['orderid'])}" class="btn btn-danger" onclick="if(confirm('确定操作?')==false)return false;">手动清除任务</a>
                                </eq>
                            </td>
                        </tr>
                    </volist>
                <else/>
                    <td colspan="9" class="text-center"> aOh! 暂时还没有内容! </td>
                </notempty>
            </tbody>
        </table>
    </div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
	<script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

	<script type="text/javascript">
            //搜索功能
            $("#search").click(function(){
                    var url = $(this).attr('url');
                    var query  = $('.search-form').find('input').serialize();
                    var queryselect = $('.search-form').find('select').serialize();
                    query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
                    query = query.replace(/^&/g,'');
                    queryselect = queryselect.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
                    queryselect = queryselect.replace(/^&/g, '');
                    if( url.indexOf('?')>0 ){
                        url += '&' + query;
                        url += '&' + queryselect;
                    }else{
                        url += '?' + query;
                        url += '?' + queryselect;
                    }
                    window.location.href = url;
            });
            
            //回车搜索
            $(".search-input").keyup(function(e){
                    if(e.keyCode === 13){
                            $("#search").click();
                            return false;
                    }
            });
            
            //导航高亮
            highlight_subnav('{:U('LogisticsUser/taskManager')}');
	</script>
</block>
